package wicket;

//import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.CompoundPropertyModel;

import plantasVsZombies.Tablero;
//import org.apache.wicket.markup.html.link.PageLink;

/**
 * Homepage
 */
public class HomePage extends WebPage {

	private static final long serialVersionUID = 1L;
	private Tablero tablero;

	public HomePage() {
		this.tablero = new Tablero();
		this.tablero.jugar();
		Form<Tablero> form = new Form<Tablero>("tableroForm", new CompoundPropertyModel<Tablero>(this.tablero));
		
		this.addFields(form);
		this.addActions(form);
		this.add(form);
	}

	private void addActions(Form<Tablero> form) {
		form.add(new Button("jugar") {
			@Override
			public void onSubmit() {
				this.setResponsePage(new TableroPage(HomePage.this.tablero));
			}
		});	
	}

	private void addFields(Form<Tablero> form) {
		form.add(new TextField<Double>("filasTerrestres"));
		form.add(new TextField<Double>("filasAcuaticas"));
		form.add(new FeedbackPanel("feedbackPanel"));	
	}
}
